<template>
  <div class="details">
    <!-- 大图 -->
    <HeadNavTwo class="hab" />
    <div class="img">
      <img :src="itemData.url" alt="" />
    </div>
    <!-- 店面地址 -->
    <div class="site">{{ itemData.location }}</div>
    <!-- 租金 转让费 面积 -->
    <div class="message">
      <div class="rent">
        <p class="p1">租金</p>
        <p class="p2">{{ itemData.price }}元/月</p>
      </div>
      <div class="transfer">
        <p class="p1">转让费</p>
        <p class="p2">面议</p>
      </div>
      <div class="area">
        <p class="p1">面积</p>
        <p class="p2">{{ itemData.area }}㎡</p>
      </div>
    </div>
    <!-- 地址 地图 -->
    <div class="siteMap">
      <div class="st">北京市石景山区</div>
      <div class="itMap">
        <i>地图</i>
        <img src="../../assets/images/next.png" alt="" />
      </div>
    </div>
    <!-- 铺源详情 -->
    <div class="shopDet">
      <ul class="shopDetLeft">
        <li>
          租赁类型: <span>{{ itemData.zllx }}</span>
        </li>
        <li>
          所在楼层: <span>{{ itemData.szlc }}楼</span>
        </li>
        <li>
          所在环线: <span>{{ itemData.szhx }}环</span>
        </li>
      </ul>
      <ul class="shopDetRight">
        <li>
          店铺类型: <span>{{ itemData.dplx }}</span>
        </li>
        <li>
          所在县区: <span>{{ itemData.szxq }}县</span>
        </li>
        <li>
          所在商圈: <span>{{ itemData.szsq }}环</span>
        </li>
      </ul>
      <router-link :to="{ name: 'StoreDetails', params: { id: itemData } }"
        ><el-button class="btn">铺源信息详情</el-button></router-link
      >
    </div>
    <!-- 配套设施 -->
    <div class="facility">
      <div class="f-top">
        <h2 class="title">配套设施</h2>
        <div class="img">
          <img src="../../assets/images/slt.png" alt="" />
          <p>上水</p>
        </div>
        <div class="img">
          <img src="../../assets/images/slt.png" alt="" />
          <p>下水</p>
        </div>
      </div>
      <div class="f-bottom">
        <h2 class="title">铺源描述</h2>
        <div>位置:{{ itemData.location }}</div>
        <div class="adv">优势:{{ itemData.desc }}</div>
      </div>
      <el-button class="btn">查看更多</el-button>
    </div>
    <!-- 店铺推荐 -->
    <div class="recommend">
      <h2 class="title">商铺推荐</h2>
      <!-- 这里是商铺推荐 -->
      <!-- <Product /> -->
    </div>
    <!-- 页脚 -->
    <div class="foot">
      <div class="foot-bottom">
        <div class="shoucang" v-if="!isShoucang" @click="shoucang">
          <img src="../../assets/images/shoucang.png" alt="" />
          <p>收藏</p>
        </div>
        <div class="shoucang" v-else @click="shoucang">
          <img src="../../assets/images/shoucang1.png" alt="" />
          <p>已收藏</p>
        </div>
        <el-button class="phone">联系店主</el-button>
      </div>
    </div>
  </div>
</template>

<script>
// import Product from "../../components/Product"
import HeadNavTwo from "../../components/HeadNavTwo";
import { mapState, mapMutations } from "vuex";
export default {
  name: "StDetails",
  //   compontens:{
  //       Product
  //   }
  components: {
    HeadNavTwo,
  },
  computed: {
    ...mapState("storeModule", {
      info: (state) => state.info,
    }),
  },
  data() {
    return {
      isShoucang: false,
      itemData: {},
    };
  },
  methods: {
    ...mapMutations('scModule',['setSc']),
    shoucang() {
      this.isShoucang = !this.isShoucang;
      this.setSc(this.itemData)
    },
  },
  mounted() {
    // this.itemData = this.$route.params.id;
    if (this.$route.params.id) {
      const setItem = localStorage.setItem(
        "getItemData",
        JSON.stringify(this.$route.params.id)
      );
      this.itemData = this.$route.params.id;
    } else {
      this.itemData = this.info;
      const getItem = JSON.parse(localStorage.getItem("getItemData"));
      // console.log(getItem);
      this.itemData = getItem;
    }
  },
};
</script>

<style lang="less" scoped>
.details {
  background-color: #fff;
  position: relative;
  .hab {
    position: absolute;
    top: 10px;
    left: 10px;
  }
  .img {
    width: 100%;
    height: 192px;
    img {
      width: 100%;
      height: 100%;
    }
  }
  //   地址
  .site {
    width: 100%;
    height: 76px;
    padding: 10px 12px;
    box-sizing: border-box;
    font-size: 18px;
    text-align: left;
    color: #101010;
    border-bottom: 1px solid #eee;
  }
  // 租金 转让费 面积
  .message {
    width: 100%;
    height: 86px;
    display: flex;
    text-align: center;
    div {
      height: 86px;
      flex: 1;
      .p1 {
        margin-top: 12px;
        margin-bottom: 7px;
        color: #666666;
        font-size: 14px;
      }
      .p2 {
        font-size: 14px;
        color: #ff4444;
      }
    }
  }
  // 地址地图
  .siteMap {
    width: 100%;
    height: 50px;
    padding: 14px 0 13px 12px;
    box-sizing: border-box;
    background-color: #eee;
    .st {
      float: left;
      color: #101010;
      font-size: 16px;
    }
    .itMap {
      width: 50px;
      float: right;
      //   height: 50px;
      display: flex;
      margin: 0 auto;
      i {
        color: #999;
      }
      img {
        width: 21px;
        height: 21px;
      }
    }
  }
  //   铺源详情
  .shopDet {
    width: 100%;
    height: 155px;
    padding: 10px 10px 0 10px;
    box-sizing: border-box;
    .shopDetLeft {
      width: 50%;
      height: 107px;

      float: left;
      li {
        height: 33.33%;
        font-size: 16px;
      }
    }
    .shopDetRight {
      float: right;
      width: 50%;
      height: 107px;
      li {
        height: 33.33%;
        font-size: 16px;
      }
    }
  }
  // 配套设施
  .facility {
    width: 100%;
    height: 354px;
    background-color: #eee;
    padding-top: 10px;
    box-sizing: border-box;
    .f-top {
      width: 100%;
      height: 120px;
      background-color: #fff;
      padding: 10px 10px;
      box-sizing: border-box;

      .img {
        width: 30px;
        height: 30px;
        margin-right: 10px;
        float: left;
        img {
          width: 100%;
          height: 100%;
          margin-bottom: 10px;
        }
        p {
          font-size: 12px;
        }
      }
    }
    .f-bottom {
      width: 100%;
      height: 165px;
      margin-top: 10px;
      background-color: #fff;
      padding: 10px 10px;
      box-sizing: border-box;
      div {
        font-size: 13px;
      }
      .adv {
        margin-top: 10px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
      }
    }
  }
  //   商铺推荐
  .recommend {
    width: 100%;
    .title {
      padding: 10px;
    }
  }
  // 页脚
  .foot {
    width: 100%;
    height: 109px;
    position: relative;
    background-color: #eee;
    .foot-bottom {
      position: absolute;
      left: 0;
      bottom: 0;
      background-color: #fff;
      width: 100%;
      height: 60px;
      padding: 10px 30px 10px;
      box-sizing: border-box;
      display: flex;
      .shoucang {
        // width: 70px;
        flex: 1;
        height: 100%;
        img {
          width: 30px;
          height: 30px;
        }
      }
      .phone {
        flex: 3;
        width: 100%;
        background-color: purple;
        color: #fff;
      }
    }
  }
}
.btn {
  width: 100%;
  color: purple;
}
.title {
  font-size: 16px;
  padding-bottom: 10px;
}
</style>